package com.stellar.circle.controller.admin.sSchoolAdmin;

import com.stellar.circle.controller.admin.sSchoolAdmin.vo.SSchoolAdminRequestPageVO;
import com.stellar.circle.controller.admin.sSchoolAdmin.vo.SSchoolAdminRequestVO;
import com.stellar.circle.controller.admin.sSchoolAdmin.vo.SSchoolAdminResponseVO;
import com.stellar.circle.domain.sSchoolAdmin.SSchoolAdminDomainService;

import com.stellar.web.core.bean.PageResult;
import com.stellar.web.core.bean.Result;
import com.stellar.web.core.validator.ValidatorRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 学校管理员映射表控制器
 *
 * @author Jqchan
 * @version 1.0
 * @date 2025-05-17 18:48:51
 */
@RequestMapping("/api-admin/sSchoolAdmin")
@RestController("adminSSchoolAdminController")
@Slf4j
public class SSchoolAdminController {

    @Resource
    private SSchoolAdminDomainService sSchoolAdminDomainService;

    /**
     * 分页查询学校管理员映射表
     */
    @ValidatorRole
    @PostMapping("/page")
    public Result<PageResult<SSchoolAdminResponseVO>> page(@RequestBody SSchoolAdminRequestPageVO requestPageVO) {
        return Result.success(sSchoolAdminDomainService.page(requestPageVO));
    }

    /**
     * 新增学校管理员映射表
     */
    @ValidatorRole
    @PostMapping("/create")
    public Result<Boolean> create(@RequestBody SSchoolAdminRequestVO requestVO) {
        return Result.success(sSchoolAdminDomainService.insert(requestVO));
    }

    /**
     * 修改学校管理员映射表
     */
    @ValidatorRole
    @PostMapping("/update")
    public Result<Boolean> update(@RequestBody SSchoolAdminRequestVO requestVO) {
        return Result.success(sSchoolAdminDomainService.update(requestVO));
    }

    /**
     * 删除学校管理员映射表
     */
    @ValidatorRole
    @DeleteMapping("/delete/{id}")
    public Result<Boolean> delete(@PathVariable("id") Long id) {
        return Result.success(sSchoolAdminDomainService.delete(id));
    }

    /**
     * 获取学校管理员映射表详情
     */
    @ValidatorRole
    @GetMapping("/get/{id}")
    public Result<SSchoolAdminResponseVO> get(@PathVariable("id") Long id) {
        return Result.success(sSchoolAdminDomainService.get(id));
    }
}
